package com.taxi.genertor;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
 * @Author: aniu
 * @Date: 2023/9/28
 * @ClassName: MySqlGenertor
 * @Description: 自动生成代码工具类
 * @Version: 1.0
 */
public class MySqlGenertor {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://127.0.0.1:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8",
                "root","root")
                .globalConfig(builder -> {
                    builder.author("aniu").fileOverride().outputDir("D:\\worry-free-travel\\service-driver-user\\src\\main\\java");
                })
                .packageConfig(builder -> {
                    builder.parent("com.taxi").pathInfo(Collections.singletonMap(OutputFile.mapperXml,
                            "D:\\worry-free-travel\\service-driver-user\\src\\main\\java\\com\\taxi\\mapper"));
                })
                .strategyConfig(builder -> {
                    builder.addInclude("driver_user_work_status");
                })
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
